<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>

    </style>
    <script src="../../vue.js"></script>

</head>

<body>
    <div id="app">
        <h1>请选择你喜欢的专栏</h1>
        <span v-for="(itme,index) in arr"><input type="checkbox" @click="put(itme)">{{itme}}</span>
        <ul>
            <li v-for="itme in err">{{itme}}</li>
        </ul>

    </div>

    <script>
        Vue.config.productionTip = false;
        new Vue({
            data: {
                arr: ["科幻", "喜剧", "动漫", "冒险", "科技", "军事", "娱乐", "奇闻"],
                err: [],
                fax: 0

            },
            methods: {
                put(but) {
                    this.fax = 0
                    if (this.err !== []) {
                        this.err.forEach((itme, index) => {
                            if (itme === but) {
                                this.err.splice(index, 1)
                                return this.fax = 1
                            };
                        });
                    }
                    if (!this.fax) this.err.push(but);
                }
            }
        }).$mount('#app')
    </script>
</body>

</html>